UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VHndSmZ1JzRmKilVX3MgEwe+qKYJZaeZeK9QE8L/P18='
WHERE
key_id = '82c6e9342f6802ce6d7373095d39e8a693e146ccc495b370e60a2a339ac98840'
AND (
token = 'VHndSmZ1JzRmKilVX3MgEwe+qKYJZaeZeK9QE8L/P18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)