UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cs6OFOVhFFW839ReB5KZFaS3isctGtQxAjDQ6vkaLO0='
WHERE
key_id = '9988f37d440b2f1c22e0e0d4ec86e411153ad3c87eac8650b195bc231094d01e'
AND (
token = 'Cs6OFOVhFFW839ReB5KZFaS3isctGtQxAjDQ6vkaLO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)