UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xWKrR+RfcfKtErzudKskf0bFc401jZX7IoR+JpsjnoE=' 
WHERE 
  key_id = '9663d43bf90d263dea69db647cf5af684f88e3ef957cff95612088967f5b0f1d' 
  AND (
    token = 'xWKrR+RfcfKtErzudKskf0bFc401jZX7IoR+JpsjnoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039