UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mk8gyfrBb4W8rIa4q6PPKgg5p1fU0PW+ORYibebtzdw=' 
WHERE 
  key_id = '211154b0fa48290ce21ba4f2168b04669b84a36a54e0de5e11877099f77e6adc' 
  AND (
    token = 'Mk8gyfrBb4W8rIa4q6PPKgg5p1fU0PW+ORYibebtzdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017