UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QYKj6h6+3T19RC71waHGLNPcdFBnD7edd5Wp9wHBdlA='
WHERE
key_id = '999216175ed7bfa487b962e7ad93da788969cca3e07b6201994c5a0ea94dc663'
AND (
token = 'QYKj6h6+3T19RC71waHGLNPcdFBnD7edd5Wp9wHBdlA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)