UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3u6b13ZzModqw8xdZ8KHHarfzn3ChyrhSdY6XiTLKTE='
WHERE
key_id = 'b5657096bc777419aaec604bbdf59b8a47e7721fbefa551aa58dcea6162638fb'
AND (
token = '3u6b13ZzModqw8xdZ8KHHarfzn3ChyrhSdY6XiTLKTE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)