UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJ1rG962fDyrF4+902w++8oLIQENZWct8jjQd3rrmvs=' 
WHERE 
  key_id = 'e60b9fbd90ab6a28a8ed1581e0c67f14a6aaf422323a5154f9c5f22d9cfc2512' 
  AND (
    token = 'AJ1rG962fDyrF4+902w++8oLIQENZWct8jjQd3rrmvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043