UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g+Ia3ObXszocr7jqN3Eutm5GtTPh+TaOIsqPoKMTiG4='
WHERE
key_id = 'f6c9e0e2f101273a106b63b3ace8b84a6c3aead7a09819642db9658711ee5a20'
AND (
token = 'g+Ia3ObXszocr7jqN3Eutm5GtTPh+TaOIsqPoKMTiG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)