UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ulvTS2nneWXvhG2ArHJk4vIGzw8QUIjFFKZCWPOcHKs='
WHERE
key_id = '87173d3f4f00c7bd9e699a163a94385ec2c81c27accf0954320bb58fb067a4dd'
AND (
token = 'ulvTS2nneWXvhG2ArHJk4vIGzw8QUIjFFKZCWPOcHKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)