UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H8egVtjZ/VN1PUgxLGP3ROqsekXideo+SwDnJTYIArE=' 
WHERE 
  key_id = 'fae6d05faa7cbf9fb1f098702d35830a4c5ed9347681fdafb9e85139cdc9f620' 
  AND (
    token = 'H8egVtjZ/VN1PUgxLGP3ROqsekXideo+SwDnJTYIArE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034