UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8rVsjVd5txuiaDw2iiaZfn8WzbEwSB7Z6iblV5FKkA='
WHERE
key_id = '6d4d2f44f9a4c5ecd44f76178e4e7ec06881d933b7d31a28b7993e4cce4c007a'
AND (
token = 'N8rVsjVd5txuiaDw2iiaZfn8WzbEwSB7Z6iblV5FKkA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)