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