UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HjmEVlIUY38L+wr4Xmslbi+cR52TiqW4HvBuFCjQuGg=' 
WHERE 
  key_id = 'a1e66e59369461fe37460e97ed0582a7e7a105d69d98c450b846aec708413117' 
  AND (
    token = 'HjmEVlIUY38L+wr4Xmslbi+cR52TiqW4HvBuFCjQuGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045