UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U/893nwAeSKxtktQrMNseEvpcVcEFGUPl7ocoyCnGrw=' 
WHERE 
  key_id = 'ff1a4d4f984a9dd2a36e5958a520cf94383aa04fee94200296dd19c24776a878' 
  AND (
    token = 'U/893nwAeSKxtktQrMNseEvpcVcEFGUPl7ocoyCnGrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056