UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6JbeIszHxFP8Pl2oGGUAhoTw2MNGEzI5ClGiAClOQNE='
WHERE
key_id = 'e17e513199b955befae3e399de3bae8aa83040d279cdd1d0d29a760ad8c60a52'
AND (
token = '6JbeIszHxFP8Pl2oGGUAhoTw2MNGEzI5ClGiAClOQNE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)