UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hZyDP84vheSgea0cQ1+MOVFqGuEHDdpAHTGlOfAPmmw=' 
WHERE 
  key_id = '835ec1b4f6f07266672ddf33354210624233f5bc50e25b3d34f32358db48b598' 
  AND (
    token = 'hZyDP84vheSgea0cQ1+MOVFqGuEHDdpAHTGlOfAPmmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028