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