UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWkZ/jjykmj3i3UKwxj59gyJgJca5/P1JvmX/dWHxG0='
WHERE
key_id = '8bb36494749b6d59e2a59c67f762524eff44c3504fa572d39958c0a0aaa105d9'
AND (
token = 'KWkZ/jjykmj3i3UKwxj59gyJgJca5/P1JvmX/dWHxG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)