UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ii1yTrnFeCYe322tyi90vg020zmPv/aHgdYYLEIve8E=' 
WHERE 
  key_id = 'abebaf73b17ce61f84225f93b3befad4530fef83dd9bfb2a36d5b54e657d9fc0' 
  AND (
    token = 'ii1yTrnFeCYe322tyi90vg020zmPv/aHgdYYLEIve8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048