UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B7Zfwu6ADgZLGvecIrLppULvQsK6oZSyLZ3eUdrjUc8='
WHERE
key_id = '671f6a52faecb96d7b61cf3accd90f434ba5a377e51f31a91266b192e905f037'
AND (
token = 'B7Zfwu6ADgZLGvecIrLppULvQsK6oZSyLZ3eUdrjUc8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)