UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '90V+brsudX7mENJBlUDLqd3P2Jj0y/1eZ78YAn2/0xM=' 
WHERE 
  key_id = '7fcead37a3df9ad62e173119c353582adac60fac67e2de3df264213eb2b78dc8' 
  AND (
    token = '90V+brsudX7mENJBlUDLqd3P2Jj0y/1eZ78YAn2/0xM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021