UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gv9rpDpf0C25V3IYCV1HbYBQSz4L0NIrghSzxEdna5M=' 
WHERE 
  key_id = '6bce62aa5b6607fb4f8c015acaf3cc14fc637e61a36a1e231f0e51887af4d8e1' 
  AND (
    token = 'Gv9rpDpf0C25V3IYCV1HbYBQSz4L0NIrghSzxEdna5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034