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