UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oSObcUqD61feSEsjN7txEHPXPuTTbhOdNicUlaAOk10=' 
WHERE 
  key_id = 'b516ca248c9632d3ec3816ab198c473f7d81dae3ba82d8adcd650d1a763ab14c' 
  AND (
    token = 'oSObcUqD61feSEsjN7txEHPXPuTTbhOdNicUlaAOk10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029