UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'azyhFvg7Bw+IkZA6xSHaamYKF5XUcxeyeDQ+UMceDT0=' 
WHERE 
  key_id = 'adc4d99cff271571b4a43463c2ec2a91e30fe53b700de81e60aec0cf780b5288' 
  AND (
    token = 'azyhFvg7Bw+IkZA6xSHaamYKF5XUcxeyeDQ+UMceDT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023