UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pZa+s+ky5rCtZfPQoptpok8iqk0rWvn2CwdFNzMAc9Y='
WHERE
key_id = 'd6e491350815f82eb00040dff9a28305de8d755bca92c2f44b47e34f5cd3dd48'
AND (
token = 'pZa+s+ky5rCtZfPQoptpok8iqk0rWvn2CwdFNzMAc9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)