UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kv1mwMa2zfwmIZ+c9ZrnF18zdQyASA3ZdEb1DO5yees='
WHERE
key_id = 'fd9018776d0c12d789e58988d21ebd2571bfb05b70d5f6a292b44eed4983ce0c'
AND (
token = 'kv1mwMa2zfwmIZ+c9ZrnF18zdQyASA3ZdEb1DO5yees='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)