UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWf9ETAIa7ijMwK+yo9Knzjx5G0+/pUUGvu9BS+uq5w='
WHERE
key_id = '0dfd23ae284b806924bd31067afaa7446418e7f749aaa829d462a277d038d9cc'
AND (
token = 'XWf9ETAIa7ijMwK+yo9Knzjx5G0+/pUUGvu9BS+uq5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)