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