UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AqVIakMOzTZbwnn15vHOmkhya98h26Uk9tO8kiYvURQ='
WHERE
key_id = '5ae5e4acf5f39928cddbbc9e4babafe0af641a4837c08e8ed6d2c86d790741fc'
AND (
token = 'AqVIakMOzTZbwnn15vHOmkhya98h26Uk9tO8kiYvURQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)