UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kAFDMHarDUEylyu3x9nznF8nXwfwm1Hcw8bA5cnRz0g='
WHERE
key_id = 'c93586fca0d5228725e1c9c021cb85c240f6f7cea1aaa4cfcd6d272eee8ddf2d'
AND (
token = 'kAFDMHarDUEylyu3x9nznF8nXwfwm1Hcw8bA5cnRz0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)