UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZKPs/C7ZgcZgtJy3h9We/sALmOT0JtWgqiLaHXUBes0=' 
WHERE 
  key_id = 'a2309804dd4b540d6e4f6d12cc49c998f7b038b250f4b420a19251b1e52e9caf' 
  AND (
    token = 'ZKPs/C7ZgcZgtJy3h9We/sALmOT0JtWgqiLaHXUBes0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050