UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5a56cKnDcqmBCF7h7KZ3uWrccjol1vI6w8NLkWGu+DU='
WHERE
key_id = 'f28cdddb71f1367954b49f76d69af46e6baa03834696a67e8fd51861629787be'
AND (
token = '5a56cKnDcqmBCF7h7KZ3uWrccjol1vI6w8NLkWGu+DU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)