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