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

Query time 0.00025