UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VYO+v7KJvOT7nGZ0xoa43TTtn9Lk/ZIGQ9MN6Jpin9Y='
WHERE
key_id = 'afd90573fe07762bf77bf7ead9d5c2221972b58ca3489181d4e4a0d043dba38f'
AND (
token = 'VYO+v7KJvOT7nGZ0xoa43TTtn9Lk/ZIGQ9MN6Jpin9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)