UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YwvoNkwjW6+m27GWbE10+ZwDyI9HDcWgSOHnh6KpEm4='
WHERE
key_id = '59a9cafe2fd08f1cbd475da6e10cc4b671bc778bdb978371a97db10adcdee570'
AND (
token = 'YwvoNkwjW6+m27GWbE10+ZwDyI9HDcWgSOHnh6KpEm4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)