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