UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b6ba9G/hXj1awo1PH7C6GNFbWywYUq0/psav6GFNLLI='
WHERE
key_id = 'ddf173aa4a08d95094bd694cab7b71c95d6709c9d8d23513492bf45e492fd575'
AND (
token = 'b6ba9G/hXj1awo1PH7C6GNFbWywYUq0/psav6GFNLLI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)