UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'akc6rdpp5IkhIsG0Hr735rs5677HzBRjYqI2qLfmxCQ='
WHERE
key_id = '6f33a2f29f6dc4f96e0c1262978ae46d7453740c0ad4a10a487b2c77d57228b3'
AND (
token = 'akc6rdpp5IkhIsG0Hr735rs5677HzBRjYqI2qLfmxCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)