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