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