UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tgah8aEjQ13jZCLUR4t8/ByRE9RgH835gscdYxHhOuo='
WHERE
key_id = 'cd47b698a0332d35f1aae914af4b3891462347cd231e57f3c48fdfebe90d3a68'
AND (
token = 'tgah8aEjQ13jZCLUR4t8/ByRE9RgH835gscdYxHhOuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)