UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sd9s9Jaf3Hmq9e12Lsi+9uxPmjRAp9+XH9QNiAibT9k=' 
WHERE 
  key_id = '483aebced3676581d96f2086a205c79450fccc5991723c7aadf59cc79a79956e' 
  AND (
    token = 'sd9s9Jaf3Hmq9e12Lsi+9uxPmjRAp9+XH9QNiAibT9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023