UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0KUcPqKNxjMgum155oByTlYVrOcXs1nlimNoEUtgrE=' 
WHERE 
  key_id = '9c614273d1e91764841e506932198b612708a5ef534acc6d46e25aad1145d612' 
  AND (
    token = 'O0KUcPqKNxjMgum155oByTlYVrOcXs1nlimNoEUtgrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029