UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9BDQEtyRJ57ANkKMvUCQPvH2IztNYmDuaAJYnDTnIT8='
WHERE
key_id = 'd3626631d1361a8bed14828a8f1d89f9208036ecbab9842aec80e85920405a04'
AND (
token = '9BDQEtyRJ57ANkKMvUCQPvH2IztNYmDuaAJYnDTnIT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)