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