UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kJVctUyY96fwJbmB0YSeXMTlgkybkuMgrF5nXzz0UTg='
WHERE
key_id = 'dee581e97e90cf34259d095aaee293be5df545d9c71aa0f925f0fb551e79f759'
AND (
token = 'kJVctUyY96fwJbmB0YSeXMTlgkybkuMgrF5nXzz0UTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)